<template>
	<view class="rf-order-detail">
		<view class="order-detail" v-if="orderDetail">

			<view class="rf-goods-section" v-if="orderDetail.status =='3'">

				<view class="flexs yt-tit">
					<text>审核信息</text>
				</view>
				<view class="yt-list yt-list2">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">风控分数</text>
						<text class="cell-tip">
							{{ orderDetail.score_norm_explain || '' }}
						</text>
					</view>
				</view>

				<view class="score-box">
					<view class="nums">
						<view class="num num1" :class="orderDetail.score_norm_explain>580 ? 'cur' : ''">
							<text class="span">{{ orderDetail.score_norm_explain || 0 }}</text>
							<text class="dot"></text>
						</view>
						<view class="num num2"
							:class="(orderDetail.score_norm_explain<581 && orderDetail.score_norm_explain>550) ? 'cur' : ''">
							<text class="span">{{ orderDetail.score_norm_explain || 0 }}</text>
							<text class="dot"></text>
						</view>
						<view class="num num3"
							:class="(orderDetail.score_norm_explain<551 && orderDetail.score_norm_explain>510) ? 'cur' : ''">
							<text class="span">{{ orderDetail.score_norm_explain || 0 }}</text>
							<text class="dot"></text>
						</view>
						<view class="num num4"
							:class="(orderDetail.score_norm_explain<511 && orderDetail.score_norm_explain>475) ? 'cur' : ''">
							<text class="span">{{ orderDetail.score_norm_explain || 0 }}</text>
							<text class="dot"></text>
						</view>
						<view class="num num5"
							:class="(orderDetail.score_norm_explain<476 && orderDetail.score_norm_explain>200) ? 'cur' : ''">
							<text class="span">{{ orderDetail.score_norm_explain || 0 }}</text>
							<text class="dot"></text>
						</view>
					</view>
					<view class="score">
						<text class="t1">极低风险</text>
						<text class="t2">低风险</text>
						<text class="t3">中风险</text>
						<text class="t4">高风险</text>
						<text class="t5">极高风险</text>
					</view>
					<view class="score">
						<text class="span">720</text>
						<text class="span">580</text>
						<text class="span">550</text>
						<text class="span">510</text>
						<text class="span">475</text>
						<text class="span cur">200</text>
					</view>
				</view>

				<view class="yt-list yt-list2">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">风控建议</text>
						<text class="cell-tip">
							{{ orderDetail.verify_recomment || '' }}
						</text>
					</view>
				</view>
				<view class="yt-list yt-list2">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">审核建议</text>
						<text class="cell-tip">
							{{ orderDetail.cancelReson || '' }}
						</text>
					</view>
				</view>
			</view>

			<view class="rf-goods-section">
				<!-- 订单号 -->
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">订单号</text>
						<text class="cell-tip">
							{{ orderDetail.orderCode }}
						</text>
						<text class="cell-tip copy" :class="'text-' + themeColor.name"
							@tap.stop="copy(orderDetail.orderCode)">复制</text>
					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">下单时间</text>
						<text class="cell-tip">
							{{ orderDetail.createTime }}
						</text>

					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">销售价</text>
						<text class="cell-tip">
							￥{{ orderDetail.originalPrice }}
						</text>

					</view>
				</view>
			</view>
			<!-- 			<view class="yt-list">
				<view class="yt-list-cell b-b">
					<text class="cell-tit clamp">店铺信息</text>
					<text class="cell-tip">
						{{ orderDetail.storeName }}
					</text>

				</view>
			</view> -->

			<view class="rf-goods-section">
				<view class="flexs yt-tit">
					<text>客户信息</text>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">姓名</text>
						<text class="cell-tip">
							{{ orderDetail.customer.relename }}
						</text>
					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">手机</text>
						<text class="cell-tip">
							{{ orderDetail.customer.mobile }}
						</text>

					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">身份证</text>
						<text class="cell-tip">
							{{ orderDetail.customer.cardid }}
						</text>
					</view>
				</view>
				<!-- <view class="yt-list">
				<view class="yt-list-cell b-b">
					<text class="cell-tit clamp">蚂蚁链合同</text>
					<text class="cell-tip" style="width:450rpx;white-space: nowrap;text-overflow: ellipsis; overflow:hidden;">
						{{ orderDetail.antSigeUrl }}
					</text>
					<text class="cell-tip copy" :class="'text-' + themeColor.name" @tap.stop="copy(orderDetail.antSigeUrl)">复制</text>
				</view>
			</view> -->
			</view>

			<view class="rf-goods-section">
				<view class="flexs yt-tit">
					<text>门店信息</text>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">门店名称</text>
						<text class="cell-tip">
							{{ orderDetail.sysStore.storeName }}
						</text>
					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">联系人</text>
						<text class="cell-tip">
							{{ orderDetail.sysStore.contactPerson }}
						</text>

					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">手机</text>
						<text class="cell-tip">
							{{ orderDetail.sysStore.contactPhone }}
						</text>
					</view>
				</view>
				<view class="yt-list">
					<view class="yt-list-cell b-b">
						<text class="cell-tit clamp">支付宝</text>
						<text class="cell-tip">
							{{ orderDetail.sysStore.alipay }}
						</text>
					</view>
				</view>
			</view>

			<!-- <view class="rf-goods-section">
			<view class="flexs yt-tit">
				<text>商家信息</text>
			</view>
			<view class="yt-list yt-list2">
				<view class="yt-list-cell b-b">
					<text class="cell-tit clamp">商家名称</text>
					<text class="cell-tip">
						{{ orderDetail.payStore.storeName }}
					</text>
				</view>
			</view>
			<view class="yt-list yt-list2">
				<view class="yt-list-cell b-b">
					<text class="cell-tit clamp">联系人</text>
					<text class="cell-tip">
						{{ orderDetail.payStore ? orderDetail.payStore.contactPerson : '' }}
					</text>
				</view>
			</view>
			<view class="yt-list yt-list2">
				<view class="yt-list-cell b-b">
					<text class="cell-tit clamp">联系人手机</text>
					<text class="cell-tip">
						{{ orderDetail.payStore ? orderDetail.payStore.contactPhone : '' }}
					</text>
				</view>
			</view>
		</view> -->

			<view class="rf-goods-section">
				<!-- 商品列表 -->
				<view class="g-item" v-for="(item, index) in orderDetail.orderSkus" :key="index">
					<!-- <rf-image :preview="false" :src="item.skuImage"></rf-image> -->
					<image class="rf-image" mode="widthFix" :src="item.skuImage"></image>
					<view class="right">
						<view class="flexs title clamp">
							<text>{{ item.skuName }}</text>
							<text class="state" :class="'text-' + themeColor.name">{{ orderDetail.statusTips }}</text>
						</view>
						<text class="spec">总额：￥{{orderDetail.total || 0}}元</text>
						<!-- <text class="flexl spec">服务费：{{item.serverTotal}}(积分)</text> -->
					</view>
				</view>

			</view>

			<view class="rf-goods-section">
				<view class="flexs yt-tit" style="margin-bottom:20rpx;">
					<text>账单明细</text>
				</view>
				<view class="yt-list" v-for="(item, index) in records">
					<view class="yt-list-cell b-b">
						<view class="cell-tit clamp">
							<view>
								{{item.numtip}}
								<text v-if="item.status==1">【已支付】</text>
								<text v-else>【待支付】</text>
							</view>
							<text>{{item.expireTime}}</text>
						</view>
						<text class="cell-tip">
							￥{{item.money}}
						</text>
					</view>
				</view>
			</view>


			<view class="rf-goods-section">
				<view class="flexs yt-tit input-tips" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">
					<text>锁机示例截图(苹果手机锁机必须按下图上传，否则申请打款有可能退回)</text>
				</view>
				
				<view class="flexs yt-tit" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">
					<u-image v-for="item in pics" width="100%" height="300rpx" @tap="showImg(item)" :src="item"></u-image>
				</view>
				<view class="yt-list yt-list2" style="padding:0 40rpx;"
					v-if="orderDetail.status==8 && orderDetail.purchareType != ''">
					<image :src="orderDetail.payImage" mode="widthFix" style="width:300rpx;"
						@tap="showImg(orderDetail.payImage)"></image>
				</view>
				<view class="input-content" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">

					<!--上传图片-->
					<view class="flexs upload-box">
						
						<!-- -->
						<u-upload :file-list="fileList1"   :before-upload="beforeUpload" :before-remove="deletePic" name="1" multiple :maxCount="3"></u-upload> 
					</view>
				</view>
				<view class="input-item" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">
					<text class="tit">手机串码</text>
					<input placeholder="请输入输入串码或者MEID编码" v-model="codephone" />
				</view>
				<view class="flexl input-tips" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">
					<text>填入串码或者MEID编码并且订单是租用中才能申请打款</text>
					<image src="/static/img/tips.png"></image>
				</view>

				<view class="input-item" v-if="orderDetail.status==8 && orderDetail.purchareType != ''">
					<text class="tit">串码或者MEID编码</text>
					<text>{{orderDetail.phonecode}}</text>
				</view>
				<view class="flexc copys" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">
					<!-- <radio @tap="getChecked" :checked="checked ? true : false" style="transform:scale(0.7)"></radio> -->
					<text @tap="checked=!checked;" class="iconfont iconxuanzhong2"
						:style="checked ? 'color:#fa436a' : ''"></text>
					<text>我已阅读并同意</text>
					<text class="blue" @tap="navTo('/pages/news/tips?type=4')">《供货协议》</text>
				</view>
				<view class="flexl input-tips">

				</view>

				<!-- <button v-if="orderDetail.status==4 && orderDetail.presaleStatus == '2'"
				class="confirm-btn"
				:class="'bg-' + themeColor.name"
				@tap="toSubmit1"
			>
				申请打款
			</button> -->
				<!-- <button v-if="orderDetail.status==5"
				class="confirm-btn" style="margin-top:20rpx;"
				:class="'bg-' + themeColor.name"
				@tap="navTo('/pages/user/shop/sign?id='+order_id)"
			>
				上传付款截图
			</button> -->
			</view>

			<!-- 底部 -->
			<!-- -->
			<view class="footer" v-if="orderDetail.status==8 && orderDetail.purchareType == ''">
				<button class="confirm-btn" :class="'bg-' + themeColor.name" @tap="toSubmit1()">
					申请打款
				</button>

			</view>
		</view>
		<!-- 404页面 -->
		<view v-if="!orderDetail && !loading">
			<rf-no-data class="rf-no-data" :custom="true">
				<view class="title" @tap="getOrderDetail">
					{{ errInfo || '订单不存在' }}
				</view>
				<view @tap="getOrderDetail" slot="refresh" class="spec-color">重新加载</view>
			</rf-no-data>
		</view>
		<!--页面加载动画-->
		<rfLoading isFullScreen :active="loading"></rfLoading>


		<!-- <view class="bot-nav">
			<view class="bot-li" v-if="orderDetail.isBuyAnt==0" @tap="toBot(1)">
				<image src="/static/order/icon1.png"></image>
				<text class="span">一键上链</text>
			</view>
			<view class="bot-li" @tap="toBot(2)">
				<image src="/static/order/icon2.png"></image>
				<text class="span">一键保险</text>
			</view>
			<view class="bot-li" v-if="orderDetail.status==3 || orderDetail.status==4" @tap="toBot(3)">
				<image src="/static/order/icon3.png"></image>
				<text class="span">审核通过</text>
			</view>
			<view class="bot-li" @tap="toBot(4)" v-if="orderDetail.isBuyRisk==1">
				<image src="/static/order/icon4.png"></image>
				<text class="span">风控详情</text>
			</view>
			<view class="bot-li" @tap="toBot(5)">
				<image src="/static/order/icon5.png"></image>
				<text class="span">下次再来</text>
			</view>
		</view> -->

		<view class="flexc img-box" v-if="descFlag" @tap="descFlag=false;">
			<view class="desc">
				<rich-text :nodes="desc"></rich-text>
			</view>
		</view>

	</view>
</template>
<script>
	import {
		uploadImage
	} from '@/api/userInfo';
	import moment from '@/common/moment';
	import mConstData from '@/config/constData.config';
	import rfNoData from '@/components/rf-no-data';
	import {
		orderClose
	} from '@/api/product';
	import uniTag from '@/components/uni-tag/uni-tag';
	import rfKefu from '@/components/rf-kefu';
	import uUpload from "uview-ui/components/u-upload/u-upload";
	import {
		orderDetail,
		closeOrderRefundApply,
		orderCustomerRefundClose,
		orderDelete,
		orderTakeDelivery,
		orderInvoiceCreate,
		memberInfo
	} from '@/api/userInfo';
	import {
		configList
	} from '@/api/basic';
	export default {
		components: {
			uniTag,
			rfKefu,
			rfNoData,
			uUpload
		},
		data() {
			return {
				maskState: 0, // 优惠券面板显示状态
				orderDetail: {
					pickup: {}
				},
				pics:[
					"http://leaseos.oss-cn-beijing.aliyuncs.com/leaseos-20231114-e0ae52637410458e9db1193b43511b48.png",
					"http://leaseos.oss-cn-beijing.aliyuncs.com/leaseos-20231114-276668620ef1455fadf1b66104482bbd.png",
					"http://leaseos.oss-cn-beijing.aliyuncs.com/leaseos-20231114-c23e3894966c4a7b8f9bae8299fa6eeb.png"
				],
				logo: this.$mSettingConfig.appLogo,
				appName: this.$mSettingConfig.appName,
				invoiceItem: {},
				loading: true,
				errInfo: null,
				order_id: null,
				moneySymbol: this.moneySymbol,
				orderInvoiceContent: '',
				singleSkuText: this.singleSkuText,
				codephone: '',
				action: '#',//https://leaseapi.kuanhels.com/prod-api/aliyun/oss/uploadToAliOss',
				checked: false,
				records: [],
				cardUrl1: '',
				fileList1: [],
				tag: 1,
				descFlag: false,
				desc: '',
				shopType: 0 //0门店 1商家
			};
		},
		computed: {
			orderTimeLine() {
				const timeLine = [];
				if (this.orderDetail.createTime !== '0') {
					timeLine.push({
						time: this.orderDetail.createTime,
						value: '订单创建'
					});
				}
				if (this.orderDetail.cancelTime &&
					this.orderDetail.cancelTime <
					(new Date().getTime() / 1000)
				) {
					timeLine.push({
						time: this.orderDetail.cancelTime,
						value: '未付款订单关闭时间'
					});
				}

				if (this.orderDetail.payTime !== '0') {
					timeLine.push({
						time: this.orderDetail.payTime,
						value: '订单支付'
					});
				}
				if (this.orderDetail.shipping_time !== '0') {
					timeLine.push({
						time: this.orderDetail.shipping_time,
						value: '买家要求发货'
					});
				}
				if (this.orderDetail.deliveryTime !== '0') {
					timeLine.push({
						time: this.orderDetail.deliveryTime,
						value: '卖家发货'
					});
				}
				if (this.orderDetail.receivingTime !== '0') {
					timeLine.push({
						time: this.orderDetail.receivingTime,
						value: '买家确认收货'
					});
				}
				console.log(timeLine.reverse())
				return timeLine.reverse();
			}
		},
		filters: {
			orderTypeFilter(orderStatus) {
				let state = null;
				mConstData.orderType.forEach(orderItem => {
					if (orderItem.key === parseInt(orderStatus, 10)) {
						state = orderItem.value;
					}
				});
				return state;
			},
			time(val) {
				return moment(val * 1000).format('YYYY-MM-DD HH:mm:ss');
			},
			orderStatusFilter(orderStatus) {
				let state = null;
				mConstData.orderStatus.forEach(orderItem => {
					if (orderItem.key === parseInt(orderStatus, 10)) {
						state = orderItem.value;
					}
				});
				return state;
			},
			filterProductStatus(item) {
				let status = null;
				if (
					parseInt(item.refund_status, 10) !== 0 &&
					parseInt(item.refund_status, 10) !== -1 &&
					parseInt(item.refund_status, 10) !== -2
				) {
					mConstData.refundStatus.forEach(refundItem => {
						if (refundItem.key === parseInt(item.refund_status, 10)) {
							status = refundItem.value;
						}
					});
				} else if (parseInt(orderDetail.status, 10) === 4) {
					mConstData.evaluateStatus.forEach(evaluateItem => {
						if (evaluateItem.key === parseInt(item.is_evaluate, 10)) {
							status = evaluateItem.value;
						}
					});
				} else {
					mConstData.orderStatus.forEach(orderItem => {
						if (orderItem.key === parseInt(orderDetail.status, 10)) {
							status = orderItem.value;
						}
					});
					// 有物流信息则说明已发货
					if (orderDetail.status === '1' && item.shipping_status === '1') {
						status = '已发货';
					}
				}
				return status;
			},
			filterShippingType(value) {
				const data = ['', '物流配送', '买家自提', '本地配送'];
				return data[parseInt(value, 10)];
			}
		},
		onLoad(options) {
			this.order_id = options.id;
			this.tag = options.tag || 1;
			this.$http.get(memberInfo).then(async r => {
				let storeId = r.storeId;
				this.$http.get('/store/TStoreInfo/querystoreinfo?storeId=' + storeId).then(r => {
					this.shopType = r.type || 0;
				});
			})
		},
		onShow() {
			this.initData();
		},
		methods: {
			showImg(url) {
				uni.previewImage({
					urls: [url]
				});
			},
			getChecked() {
				this.checked = !this.checked;
				this.$forceUpdate();
			},
			toBot(type) {
				if (type == 1) {
					this.$http
						.get(`/ant?orderId=` + this.order_id)
						.then(() => {
							this.$mHelper.toast('操作成功!');
							setTimeout(() => {
								uni.navigateBack();
							}, 1500)
						})
				} else if (type == 2) {
					this.$http
						.get(`/insure?orderId=` + this.order_id)
						.then(() => {
							this.$mHelper.toast('操作成功!');
							setTimeout(() => {
								uni.navigateBack();
							}, 1500)
						})
				} else if (type == 3) {
					this.toAudit(1);
				} else if (type == 4) {
					// this.$http
					// 	.get(`/br?orderId=`+this.order_id)
					// 	.then(() => {
					// 		this.$mHelper.toast('操作成功!');
					// 		setTimeout(()=>{
					// 			uni.navigateBack();
					// 		}, 1500)
					// 	})
					this.desc = this.orderDetail.brJson || '';
					this.descFlag = true;
				} else if (type == 5) {
					uni.navigateBack();
				}
			},
			// 删除图片
			deletePic(event) {
				console.log(222);
				this.fileList1.splice(event.index, 1)
			},
			async beforeUpload(index, list) {
				this.fileList1 = []
				
				console.log('list',list);
				list.map(async item => {
					let result = await this.uploadFilePromise(item.url);
					this.fileList1.push({
						url: item.url,
						surl:result
					})
					console.log('result:',result);
				})
				console.log('照片列表', this.fileList1);
				return true;
			},
			
			uploadImage(index) {
				// 从相册选择6张图
				const _this = this;
				uni.chooseImage({
					count: 6,
					sizeType: ['original', 'compressed'],
					sourceType: ['album', 'camera'],
					success: async function(res) {
						await _this.handleUploadFile(res.tempFilePaths, index);
					}
				});
			},
			uploadFilePromise(item) {
				return new Promise((resolve, reject) => {
					let a = this.$http
						.upload(uploadImage, {
							filePath: item,
							image: 'file'
						})
						.then(async r => {
							setTimeout(() => {
								resolve(r)
							}, 1000)
						});
				})
			},

			toAudit(type) {
				// if(!this.codephone){
				// 	this.$mHelper.toast('请输入手机串码');
				// }
				uni.showModal({
					content: '是否确认审核?',
					success: e => {
						if (e.confirm) {
							this.$http
								.get(`/payStoreComfire?orderId=` + this.order_id + '&status=' + type)
								.then(() => {
									this.$mHelper.toast('审核成功!');
									//this.initData();
									setTimeout(() => {
										uni.navigateBack();
									}, 1500)
								})
								.catch(() => {

								});
						}
					}

				});
			},
			toSubmit1() {
				console.log('this.fileList1:',this.fileList1);
				let lockImgs = "";
				this.fileList1.forEach(function (item, index) {
					lockImgs=lockImgs+","+item.surl;
				});
				console.log('this.lockImgs:',lockImgs);
				uni.showModal({
					content: '是否申请打款?',
					success: e => {
						if (e.confirm) {
							if (!this.codephone) {
								this.$mHelper.toast('请输入手机串码或者MEID编码');
								return false
							}
							if (!this.checked) {
								this.$mHelper.toast('请阅读并同意《供货协议》');
								return false
							}
							this.$http
								.get(`/storeApply`, {
									orderId: this.order_id,
									codephone: this.codephone,
									lockImgs:lockImgs
								})
								.then(() => {
									this.$mHelper.toast('操作成功!');
									setTimeout(() => {
										uni.navigateBack();
									}, 1500)
								})
								.catch(() => {

								});

						}
					}

				});
			},
			toSubmit2() {
				uni.showModal({
					content: '是否确认订单?',
					success: e => {
						if (e.confirm) {

							this.$http
								.get(`/storeComfire`, {
									orderId: this.order_id
								})
								.then(() => {
									this.$mHelper.toast('操作成功!');
									setTimeout(() => {
										uni.navigateBack();
									}, 1500)
								})
								.catch(() => {

								});

						}
					}
				});
			},
			// 监听发票内容发生改变
			handleInvoiceContentChange(e) {
				this.orderInvoiceContent = e.detail.value;
			},
			// 显示优惠券面板
			toggleMask(type) {
				let timer = type === 'show' ? 10 : 300;
				let state = type === 'show' ? 1 : 0;
				this.maskState = 2;
				setTimeout(() => {
					this.maskState = state;
				}, timer);
			},
			stopPrevent() {},
			// 订单号复制
			copy(content) {
				let self = this;
				/* #ifdef H5 */
				this.$mHelper.h5Copy(content);
				/* #endif */
				/* #ifndef H5 */
				uni.setClipboardData({
					data: content,
					success: function() {
						self.$mHelper.toast('复制成功');
					}
				});
				/* #endif */
			},
			navTo(route) {
				this.$mRouter.push({
					route
				});
			},
			navToEvaluation(item, type) {
				this.$mRouter.push({
					route: `/pages/order/evaluation/evaluation?data=${JSON.stringify(
					item
				)}&type=${type}`
				});
			},
			navToRefund(item, type) {
				this.$mRouter.push({
					route: `/pages/order/refund/refund?data=${JSON.stringify(
					item
				)}&refundType=${type}`
				});
			},
			navToShippingReturn(item) {
				this.$mRouter.push({
					route: `/pages/order/shipping/return?data=${JSON.stringify(item)}`
				});
			},
			// 订单操作
			handleOrderOperation(item, type) {
				switch (type) {
					case 'detail': // 订单详情
						this.navTo(`/pages/order/detail?id=${item.id}`);
						break;
					case 'evaluation': // 我要评价
						this.navTo(`/pages/order/evaluation/evaluation?order_id=${item.id}`);
						break;
					case 'close': // 取消订单
						this.handleOrderClose(item.id);
						break;
					case 'delete': // 删除订单
						this.handleOrderDelete(item.id);
						break;
					case 'shipping': // 查看物流
						this.navTo(`/pages/order/shipping/shipping?id=${item.id}`);
						break;
					case 'delivery': // 确认收货
						this.handleOrderTakeDelivery(item.id);
						break;
				}
			},
			// 初始化数据
			initData() {
				this.getOrderDetail();
			},
			// 获取订单详情
			async getOrderDetail() {
				await this.$http
					.get(`/orderdetail`, {
						orderId: this.order_id
					})
					.then(r => {
						this.loading = false;
						this.orderDetail = r;
						if (this.shopType == 1) {
							this.orderDetail.sysStore = r.payStore;
						}
						this.records = r.records || [];
						if (this.invoiceItem.id && !this.orderDetail.invoice) {
							this.$http.get(configList, {
								field: 'order_invoice_content'
							}).then(r => {
								if (r.order_invoice_content) {
									this.invoiceItem.invoiceContentArr = r.order_invoice_content.split(
										',');
									this.orderInvoiceContent = this.invoiceItem.invoiceContentArr[0];
									this.toggleMask('show');
								} else {
									this.invoiceItem.invoiceContentArr = [];
									this.$mHelper.toast('请联系管理员配置发票类型');
								}
							});
						}
					})
					.catch(err => {
						this.loading = false;
						this.errInfo = err;
					});
			},
			async handleOrderInvoiceCreate() {
				await this.$http.post(orderInvoiceCreate, {
					order_id: this.orderDetail.id,
					invoice_id: this.invoiceItem.id,
					invoice_content: this.orderInvoiceContent
				}).then(() => {
					this.toggleMask();
					this.getOrderDetail();
				});
			},
			// 取消订单
			async handleOrderClose(orderId) {
				await this.$http
					.get(`${orderClose}`, {
						orderId
					})
					.then(() => {
						this.$mHelper.toast('订单取消成功');
						this.getOrderDetail();
					});
			},
			// 删除已关闭订单
			async handleOrderDelete(id) {
				await this.$http.delete(`${orderDelete}?id=${id}`, {}).then(() => {
					this.$mHelper.toast('订单删除成功');
					this.$mRouter.back();
				});
			},
			// 确认收货
			async handleOrderTakeDelivery(orderId) {
				await this.$http
					.get(`${orderTakeDelivery}`, {
						orderId
					})
					.then(() => {
						this.$mHelper.toast('确认收货成功');
						this.getOrderDetail();
					});
			},
			// 产品退款/退货关闭申请
			async handleCloseOrderRefundApply(status, id) {
				uni.showModal({
					content: '取消退款后将无法再次提交申请，是否继续取消退款?',
					success: async e => {
						if (e.confirm) {
							let closeOrderApi = closeOrderRefundApply;
							if (parseInt(status, 10) === 4) {
								closeOrderApi = orderCustomerRefundClose;
							}
							await this.$http
								.post(`${closeOrderApi}`, {
									id
								})
								.then(r => {
									this.$mHelper.toast('取消成功');
									this.getOrderDetail();
								});
						}
					}
				});
			}
		}
	};
</script>
<style lang="scss" scoped>
	.rf-order-detail {
		background: #F5F9FC;
	}

	.order-detail {
		padding-bottom: 100upx;
	}

	.rf-goods-section {
		background: #FFFFFF;
		margin-bottom: 18rpx;
		margin-top: 0;

		.g-header {
			display: flex;
			align-items: center;
			justify-content: space-between;

			.title {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.cover {
					width: 48upx;
					height: 48upx;
					border-radius: 50%;
					margin-right: 10upx;
				}
			}
		}

		.g-item {}

		.price-box {
			padding: 0 30rpx 20rpx;
		}

		.g-item:last-child {
			border-bottom: none;
		}

		.right {
			.price-box {
				display: flex;
				align-items: center;
				justify-content: space-between;
				color: $font-color-dark;
				border-bottom: 1upx solid rgba(0, 0, 0, 0.05);

				.price-wrapper {
					margin-bottom: 10upx;
					flex: 1;

					.price {
						font-size: $font-sm;
						margin-bottom: 4upx;
					}

					.number {
						font-size: $font-sm;
						color: $font-color-base;
						margin-left: $font-sm;
					}

					.original-price {
						font-size: $font-sm;
						color: $font-color-light;
						margin-left: $spacing-sm;
						text-decoration: line-through;
					}
				}

				.status {
					font-size: 24upx;
					margin-left: $spacing-sm;
				}

				.spec-color {
					color: $font-color-spec;
				}
			}

			.btn-box {
				display: flex;
				justify-content: flex-end;
				align-items: center;
				margin: $spacing-sm 0;

				.action-btn {
					font-size: $font-sm;
					margin: 0 0 0 15upx;
					padding: 0 28upx;
					color: $font-color-base;
					text-align: center;
					height: 50upx;
					border-radius: 32upx;
					line-height: 50upx;
					border: 1upx solid rgba(0, 0, 0, 0.15);
				}
			}
		}
	}

	.yt-tit {
		padding: 25rpx 40rpx 0;
		font-weight: 600;

		.btn {
			font-size: $font-sm;
			margin: 0 0 0 15upx;
			padding: 0 $spacing-lg;
			text-align: center;
			height: 60upx;
			line-height: 60upx;
		}
	}

	.yt-list {
		background: #fff;

		.yt-list-cell {
			display: flex;
			align-items: center;
			padding: 5upx 30upx 5upx 40upx;
			line-height: 70upx;
			position: relative;

			&.cell-hover {
				background: #fafafa;
			}

			&.b-b:after {
				left: 30upx;
			}

			.cell-icon {
				height: 32upx;
				width: 32upx;
				font-size: 22upx;
				text-align: center;
				line-height: 32upx;
				border-radius: 4upx;
				margin-right: 12upx;

				&.hb {
					background: #ffaa0e;
				}

				&.lpk {
					background: #3ab54a;
				}
			}

			.cell-more {
				align-self: center;
				font-size: 24upx;
				color: $font-color-light;
				margin-left: 8upx;
				margin-right: -10upx;
			}

			.cell-tit {
				flex: 1;
				font-size: 26upx;
				color: $font-color-light;
				margin-right: 10upx;
			}

			.cell-tip {
				font-size: 26upx;

				&.disabled {
					color: $font-color-light;
				}
			}

			&.desc-cell {
				.cell-tit {
					max-width: 90upx;
				}
			}

			.desc {
				flex: 1;
				font-size: $font-base;
				color: $font-color-dark;
			}

			.copy {
				margin-left: $spacing-sm;
			}
		}
	}

	.uni-timeline {
		padding: $spacing-lg;
		background-color: $color-white;
	}

	.footer {
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 98;
		width: 100%;
		background-color: $color-white;
		color: $font-color-base;
		box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
		display: flex;
		justify-content: flex-end;
		align-items: center;
		padding: 15upx $spacing-base;

		.action-btn {
			font-size: $font-sm;
			margin: 0 0 0 15upx;
			padding: 0 $spacing-lg;
			text-align: center;
			height: 60upx;
			line-height: 60upx;
		}
	}

	.rf-no-data {
		height: calc(100vh - 90upx);
	}

	.pickup-tag {
		margin-right: $spacing-sm;
	}

	/* 优惠券面板 */
	.mask {
		display: flex;
		align-items: flex-end;
		position: fixed;
		left: 0;
		top: var(--window-top);
		bottom: 0;
		width: 100%;
		background: rgba(0, 0, 0, 0);
		z-index: 99;
		transition: 0.3s;

		.mask-content {
			width: 100%;
			max-height: 70vh;
			min-height: 16vh;
			background: #f3f3f3;
			transform: translateY(100%);
			transition: 0.3s;
			overflow-y: scroll;

			.sub-list {
				padding: $spacing-lg;

				.radio-wrapper {
					display: flex;
					justify-content: space-between;
				}

				.title {
					width: 300upx;
				}

				.invoice-content {
					.invoice-content-item-radio {
						margin: 0 $spacing-sm $spacing-sm $spacing-base;
					}
				}
			}

			.confirm-btn {
				margin: $spacing-base auto $spacing-lg;
			}
		}

		&.none {
			display: none;
		}

		&.show {
			background: rgba(0, 0, 0, 0.4);

			.mask-content {
				transform: translateY(0);
			}
		}
	}

	.input-tips {
		padding: 0 30rpx 30rpx;
		background: #fff;
		color: #999;
		font-size: $font-sm + 2upx;
		margin-bottom: 30rpx;

		image {
			width: 30rpx;
			height: 30rpx;
			margin-left: 20rpx;
		}
	}

	.input-item {
		display: flex;
		padding: 0 30upx;
		background: #fff;
		height: 80upx;
		line-height: 80upx;
		border-radius: 4px;
		position: relative;

		.pick {
			width: 100%;
			height: 80rpx;
			position: absolute;
			top: 0;
			left: 0;
			z-index: 100;

			.uni-input {
				width: 100%;
				height: 80rpx;
			}
		}

		&:last-child {
			margin-bottom: 0;
		}

		.tit {
			width: 120upx;
			font-size: $font-sm + 2upx;
			color: $font-color-base;
			font-weight: bold;
		}

		.tit2 {
			min-width: 120rpx;
			width: auto;

			image {
				width: 30rpx;
				height: 30rpx;
			}
		}

		input {
			width: calc(100% - 100upx);
			height: 80upx;
			line-height: 80upx;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;
		}

		.span {
			flex: 1;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;
		}

		.cell-icon {
			color: #666;
		}

		.date {
			height: 80upx;
			line-height: 80upx;
			font-size: $font-base + 2upx;
			color: $font-color-dark;
		}

		.gender-item {
			margin-right: 20upx;

			.gender-item-text {
				padding-left: 10upx;
			}

			radio .wx-radio-input.wx-radio-input-checked {
				background: $uni-color-primary;
				border-color: $uni-color-primary;
			}
		}
	}

	.rf-image {
		width: 220rpx;
		height: 170rpx;
	}

	.bot-nav {
		width: 750rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 900;
		height: 122rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -1rpx 15rpx 0rpx rgba(0, 0, 0, 0.06);
		display: flex;
		justify-content: center;
		align-items: center;

		.bot-li {
			width: 140rpx;
			height: 81rpx;
			position: relative;

			image {
				width: 100%;
				height: 100%;
				position: absolute;
				top: 0;
				left: 0;
				z-index: 1;
			}

			.span {
				position: relative;
				z-index: 100;
				padding-left: 19rpx;
				line-height: 70rpx;
				font-size: 19rpx;
				color: #fff;
			}
		}
	}

	.score-box {
		padding: 0 30rpx 0 40rpx;

		.score {
			display: flex;
			justify-content: center;
			align-items: center;
			position: relative;

			text {
				width: 20%;
				height: 32rpx;
				text-align: center;
				font-size: 15rpx;
				color: #fff;
				line-height: 32rpx;
			}

			.t1 {
				background-color: #74D13B;
			}

			.t2 {
				background-color: #38CECC;
			}

			.t3 {
				background-color: #44A8FD;
			}

			.t4 {
				background-color: #FEAB43;
			}

			.t5 {
				background-color: #FD4046;
			}

			.span {
				text-align: left;
				font-size: 15rpx;
				color: #303442;
			}

			.cur {
				position: absolute;
				top: 0;
				right: 0;
				z-index: 100;
				text-align: right;
			}
		}

		.nums {
			height: 46rpx;
			display: flex;
			justify-content: center;
			align-items: flex-start;
			position: relative;

			.num {
				width: 20%;
				position: relative;
				opacity: 0;

				.span {
					width: 48rpx;
					height: 36rpx;
					background: #FD4046;
					font-size: 15rpx;
					color: #fff;
					text-align: center;
					line-height: 36rpx;
					position: absolute;
					z-index: 100;
				}

				.dot {
					width: 15rpx;
					height: 15rpx;
					background-color: #FD4046;
					transform: rotate(45deg);
					position: absolute;
					top: 24rpx;
					left: 16rpx;
					z-index: 1;
				}
			}

			.num1 {

				.span,
				.dot {
					background-color: #74D13B;
				}
			}

			.num2 {

				.span,
				.dot {
					background-color: #38CECC;
				}
			}

			.num3 {

				.span,
				.dot {
					background-color: #44A8FD;
				}
			}

			.num4 {

				.span,
				.dot {
					background-color: #FEAB43;
				}
			}

			.num5 {

				.span,
				.dot {
					background-color: #FD4046;
				}
			}

			.cur {
				opacity: 1;
			}
		}
	}

	.img-box {
		background-color: rgba(0, 0, 0, 0.6);
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 900;

		.desc {
			width: 600rpx;
			padding: 50rpx;
			font-size: 28rpx;
			line-height: 200%;
			background-color: #fff;
			border-radius: 20rpx;
		}
	}

	.input-content {
		padding: 20upx 30upx;

		.input-tit {
			font-size: $font-base + 2upx;
			font-weight: 600;
			margin-bottom: 30rpx;

			image {
				width: 40rpx;
				height: 40rpx;
				margin-left: 20rpx;
			}
		}

		.input-item {
			display: flex;
			padding: 0 30upx;
			background: $page-color-light;
			height: 80upx;
			line-height: 80upx;
			border-radius: 4px;
			margin-bottom: 30upx;
			position: relative;

			.pick {
				width: 100%;
				height: 80rpx;
				position: absolute;
				top: 0;
				left: 0;
				z-index: 100;

				.uni-input {
					width: 100%;
					height: 80rpx;
				}
			}

			&:last-child {
				margin-bottom: 0;
			}

			.tit {
				width: 120upx;
				font-size: $font-sm + 2upx;
				color: $font-color-base;
				font-weight: bold;
			}

			.tit2 {
				min-width: 120rpx;
				width: auto;

				image {
					width: 30rpx;
					height: 30rpx;
				}
			}

			input {
				width: calc(100% - 100upx);
				height: 80upx;
				line-height: 80upx;
				font-size: $font-sm + 2upx;
				color: $font-color-dark;
			}

			.span {
				flex: 1;
				font-size: $font-sm + 2upx;
				color: $font-color-dark;
			}

			.cell-icon {
				color: #666;
			}

			.date {
				height: 80upx;
				line-height: 80upx;
				font-size: $font-base + 2upx;
				color: $font-color-dark;
			}

			.gender-item {
				margin-right: 20upx;

				.gender-item-text {
					padding-left: 10upx;
				}

				radio .wx-radio-input.wx-radio-input-checked {
					background: $uni-color-primary;
					border-color: $uni-color-primary;
				}
			}
		}
	}
</style>